/**      
 * @file		partiallyFilled.cpp
 * @description	This example demonstrates a partially filled array.
 *				Instead of relying on the declared size of the array,
 *				we use another variable called "size". This allows us to
 *				only fill the array partially and determine the amount of
 *				elements in the array by the size variable. Thus, we can
 *				declare an array of one size and only use certain elements
 *				of the array.
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

/**
 * @return zero if the application executes successfully
 */
int main() {
	int numbers[10];
	int size = 0;
	int value;
	
	for (int i = 0; i < 10; i++) {
		// Read and store numbers in an array if it is not in the array
		cout << "Enter an integer: ";
		cin >> value;

		bool isInArray = false;

		// here's where we deal with a paritally filled array
		for (int j = 0; j < size; j++) {	// here we use size
			if (numbers[j] == value) {		// instead of 10
				isInArray = true;			// since we only have
				break;						// a certain number of 
			}								// elements in the array
		}									// and not all 10 elements

		if (!isInArray) {
			numbers[size++] = value;		// remember what the post-increment
		}									// does?
	}

	
	// The code above ensures that we don't have duplicate ints
	// in the array. Try typing 5 ten times as the input
	cout << "Here is what is in the array of " << size << " ints:\n";
	for (int i = 0; i < size; i++) {
		cout << numbers[i] << " ";
	}
	cout << endl;
	return 0;
}

